home *** CD-ROM | disk | FTP | other *** search
- package de.trantor.mail.demo.j2me;
-
- import java.util.Vector;
- import javax.microedition.lcdui.Command;
- import javax.microedition.lcdui.Displayable;
- import javax.microedition.lcdui.Image;
- import javax.microedition.lcdui.List;
-
- public class InboxScreen extends List {
- public static Command READ = new Command("Read", 1, 1);
- public static Command WRITE = new Command("Write", 1, 2);
- public static Command DELETE = new Command("Delete", 1, 5);
- public static Command EXIT = new Command("Exit", 1, 8);
- private static Image image;
-
- public InboxScreen(MailMIDlet midlet) {
- super("Inbox", 3);
- ((Displayable)this).addCommand(READ);
- ((Displayable)this).addCommand(WRITE);
- ((Displayable)this).addCommand(DELETE);
- ((Displayable)this).addCommand(EXIT);
- ((Displayable)this).setCommandListener(midlet);
-
- try {
- image = Image.createImage("/Icon.png");
- } catch (Exception var3) {
- }
-
- }
-
- public void setMessages(Vector messages) {
- for(int i = ((List)this).size() - 1; i >= 0; --i) {
- ((List)this).delete(i);
- }
-
- for(int i = 0; i < messages.size(); ++i) {
- if (i == 0) {
- ((List)this).append((String)messages.elementAt(i), image);
- } else {
- ((List)this).insert(0, (String)messages.elementAt(i), image);
- }
- }
-
- }
-
- public int getMessageIndex() {
- return ((List)this).getSelectedIndex();
- }
- }
-